﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EventMgrLib;
using SmartMotion.Core;
using WeifenLuo.WinFormsUI.Docking;

namespace SmartMotion.Pages.DockPages
{
    public partial class FrmProperty : DockContent
    {
        public FrmProperty()
        {
            InitializeComponent();
        }

        private void FrmProperty_Load(object sender, EventArgs e)
        {
            HideOnClose = true;
            EventMgr.Ins.GetEvent<SelectedObjectChanged>().Subscribe(SelectedObject);
        }

        private void SelectedObject(object obj)
        {
            propertyGrid1.SelectedObject = obj;
        }

        private void FrmProperty_FormClosing(object sender, FormClosingEventArgs e)
        {
            EventMgr.Ins.GetEvent<SelectedObjectChanged>().Unsubscribe(SelectedObject);
        }
    }   
}
    